import request from '@/utils/request'
import { IListParams, Admin, ICreateData } from '@/api/types/common'

// 管理员接口

// 查
export const getAdmins = (params:IListParams) => {
  return request<{
    count:number,
    list:Admin[]
  }>({
    method: 'GET',
    url: '/setting/admin',
    params
  })
}

// 创建
export const createAdmins = (data:ICreateData) => {
  return request({
    method: 'POST',
    url: '/setting/admin',
    data
  })
}

// 编辑
export const editAdmins = (id:number, data:ICreateData) => {
  return request({
    method: 'PUT',
    url: `/setting/admin/${id}`,
    data
  })
}

// 删除
export const deleteAdmins = (id:number) => {
  return request({
    method: 'DELETE',
    url: `/setting/admin/${id}`
  })
}

// 修改状态
export const changeStatus = (id:number, status:number) => {
  return request({
    method: 'PUT',
    url: `/setting/set_status/${id}/${status}`
  })
}
